package mhwi.cards.taidao;

import com.megacrit.cardcrawl.actions.common.DamageAction;
import com.megacrit.cardcrawl.actions.common.GainBlockAction;
import com.megacrit.cardcrawl.cards.DamageInfo;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.core.CardCrawlGame;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.localization.CardStrings;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
import mhwi.cards.BaDaoCard;
import mhwi.helper.ModHelper;

import static mhwi.constants.ResourcesConstant.EXTENSION_PNG;
import static mhwi.constants.ResourcesConstant.PATH_IMG_CARDS_TAIDAO;
import static mhwi.enums.ModEnums.PlayerColorEnum.CARD_COLOR_HUNTER_TAIDAO;

public class HouTuiZhanCard extends BaDaoCard {
    private static final String CLASS_NAME = HouTuiZhanCard.class.getSimpleName();
    public static final String ID = ModHelper.makeId(CLASS_NAME);
    private static final CardStrings CARD_STRINGS = CardCrawlGame.languagePack.getCardStrings(ID);
    private static final String NAME = CARD_STRINGS.NAME;
    private static final String IMG_PATH = ModHelper.makeFileName(PATH_IMG_CARDS_TAIDAO, CLASS_NAME, EXTENSION_PNG);
    private static final String DESCRIPTION = CARD_STRINGS.DESCRIPTION;
    private static final CardColor COLOR = CARD_COLOR_HUNTER_TAIDAO;

    private static final int COST = 1;
    private static final CardRarity RARITY = CardRarity.COMMON;
    private static final CardType TYPE = CardType.ATTACK;
    private static final CardTarget TARGET = CardTarget.ENEMY;

    public HouTuiZhanCard() {
        super(ID, NAME, IMG_PATH, COST, DESCRIPTION, TYPE, COLOR, RARITY, TARGET);
        this.baseDamage = 5;
        this.baseBlock = 5;

        this.tags.add(CardTags.STRIKE);
    }

    // 升级卡牌
    @Override
    public void upgrade() {
        if (!upgraded) {
            upgradeName();
            upgradeDamage(2);
            upgradeBlock(2);

            this.rawDescription = CARD_STRINGS.UPGRADE_DESCRIPTION;
            initializeDescription();
        }
    }

    // 使用卡牌
    @Override
    public void use(AbstractPlayer p, AbstractMonster m) {
        AbstractDungeon.actionManager.addToTop(new DamageAction(m, new DamageInfo(p, this.damage, DamageInfo.DamageType.NORMAL)));
        AbstractDungeon.actionManager.addToTop(new GainBlockAction(p, this.block));
    }
}